/*
 * create on 2012-5-11
 * Copy right (2012)
 * eking All rights reserved
 */
package com.myway.dto.ticket.domain;
import java.util.HashMap;

/**
 * @author 郑兴(zhengxing)
 *
 */
public enum RefundErrorFixStatus {
	UNDO("UNDO"),				//退票异常，未处理
	HANDLED("HAND"),	        //退票异常，已处理
	DELETE("DEL");              //系统退成功，已删除
	
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the sms status enum with alias name as key.
	 */
	private static HashMap<String, RefundErrorFixStatus> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, RefundErrorFixStatus>();
		for (RefundErrorFixStatus status : RefundErrorFixStatus.values()) {
			map.put(status.alias, status);
		}
	}

	RefundErrorFixStatus(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	public String getAlias() {
		return alias;
	}

	/**
	 * Return a <code>RefundErrorFixStatus</code> object holding the value of specified alias name
	 * 
	 * @param alias
	 *            the alias name of the status
	 * 
	 * @return a <code>RefundErrorFixStatus</code> object holding the value represented by the alias name
	 *         argument
	 */
	public static RefundErrorFixStatus valueOfAlias(String alias) {
		RefundErrorFixStatus status = map.get(alias);

		if (status == null) {
			throw new IllegalArgumentException("Unknown sms send status alias [" + alias + "]");
		}

		return status;
	}
}
